<form class="form-horizontal" name="disk_form">
    <div class="modal-header">
        <a class="close" ng-click="close()">×</a>

        <h5>{{ title }}</h5>
    </div>
    <div class="modal-body">
        <div class="">
        <form class="form-horizontal ">
            <div class="control-group" ng-hide="update||fromcluster">
                <label for="cluster" class="control-label">类型</label>

                <div class="controls">
                    <select class="span2" ng-model="disk.device_type" ng-required="!fromcluster">
                        <option value="cdrom">cdrom</option>
                        <option value="disk" >disk</option>
                    </select>
                </div>
            </div>
            <div class="control-group" ng-show="disk.device_type=='cdrom'">
                <label for="cluster" class="control-label">ISO</label>

                <div class="controls">
                    <select class="" ng-options="iso.name group by iso.storage for iso in isos" ng-model="disk.isopath">
                        <option value="">无</option>
                            </select>
                </div>
            </div>
            <div class="control-group" ng-hide="disk.device_type=='cdrom'||update">
                <label for="cluster" class="control-label">存储</label>

                <div class="controls">
                    <select  class="span2" ng-required="disk.device_type=='disk'" ng-options="s.name for s in storages" ng-model="disk.storage" ng-change="change_storage()">
                    </select>
                </div>
            </div>
            <div class="control-group" ng-show="disk.storage.protocol=='iscsi'">
                <label for="cluster" class="control-label">lun</label>
                <div class="controls">
                    <select class="span2" ng-options="l.display group by l.type for l in luns" ng-model="disk.lun" ng-change="change_lun()"></select>
                </div>
            </div>
            <div class="control-group" ng-hide="disk.device_type=='cdrom'||update">
                <label for="name" class="control-label">名称</label>

                <div class="controls">
                    <input type="text" id="name" class="input"  ng-required="disk.device_type=='disk'" ng-model="disk.name" ng-disabled="disk.lun.id">
                </div>
            </div>
            <div class="control-group" ng-hide="disk.device_type=='cdrom'||update">
                <label for="cluster" class="control-label">磁盘分配</label>

                <div class="controls">
                    <select class="span2"  ng-required="disk.device_type=='disk'" ng-model="disk.format" ng-disabled="disk.storage.protocol=='iscsi'">
                        <option value="raw">固定大小</option>
                        <option value="qcow2">动态分配</option>
                    </select>
                </div>
            </div>
            <div class="control-group" ng-hide="disk.device_type=='cdrom'">

                <label for="dec" class="control-label">容量</label>

                <div class="controls" ng-hide="disk.device_type=='cdrom'">
                    <input type="text"  ng-required="disk.device_type=='disk'" ng-disabled="resize_condition||disk.storage.protocol=='iscsi'" class="input-mini" ng-model="disk.size"> GB
                    <span  ng-show="update"><i class="icon-info-sign"/>{{ disk_msg || "磁盘容量不能小于原来的容量"}}</span>
                </div>
            </div>
             <div class="control-group" ng-hide="disk.device_type=='cdrom'">
                    <label class="control-label">磁盘总线</label>

                    <div class="controls">
                        <select class="span2" ng-required="disk.device_type=='disk'"  ng-model="disk.bus" ng-disabled="disk.storage.protocol=='iscsi'">
                            <option value="ide">IDE</option>
                            <option value="scsi">SCSI</option>
                            <!--<option>SATA</option>
                            <option>SCSI</option>
                            <option>USB</option>-->
                            <option value="virtio">Virtio</option>
                        </select>
                    </div>
                </div>
            <!--<div class="control-group" ng-hide="disk.device_type=='cdrom'||update">
                <label for="dec" class="control-label">分配</label>

                <div class="controls">
                    <input type="text"  ng-required="disk.device_type=='disk'" class="input-mini" ng-model="disk.size"> GB
                </div>
            </div>-->
            <!--<div class="control-group" ng-hide="disk.device_type=='cdrom'">
                <div class="controls">
                    <label class="checkbox inline">
                        <input type="checkbox" ng-model="disk.readonly"> 只读
                    </label>
                    <label class="checkbox inline">
                        <input type="checkbox" value="option2" id="inlineCheckbox2"> 共享
                    </label>
                </div>
            </div>-->
            <div class="control-group" ng-hide="disk.device_type=='cdrom'">
                <i class="icon-arrow-down"></i><a ng-click="hasadvance = !hasadvance">高级</a>
            </div>
            <!--点击高级，或者在修改模式下磁盘为disk类型-->
            <div id="disk_advance" ng-show="hasadvance||(update&&disk.device_type=='disk')">
                <div class="control-group">
                    <label class="control-label">cache</label>

                    <div class="controls">
                        <select class="span2" ng-model="disk.cache">
                            <option>default</option>
                            <option>none</option>
                            <option>writethrough</option>
                            <option>writeback</option>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">IO模式</label>

                    <div class="controls">
                        <select class="span2" ng-model="disk.iomode">
                            <option>default</option>
                            <option>native</option>
                            <option>threads</option>
                        </select>
                    </div>
                </div>
            </div>
        </form>

    </div>
    </div>
    <div class="modal-footer">
        <a data-dismiss="modal" class="btn" ng-click="close()">关闭</a>
        <button type="submit" ng-disabled="!disk_form.$valid" ng-click="handle_disk()" class="btn btn-primary">保存</button>
    </div>
</form>


